package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**
 * 说明:
 *
 * @author:SuZhongHe
 * @date:2023/3/8
 **/
public class Text2 {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("note.txt");
        System.out.println("注意输入'exit'退出程序;请输入文字");
        while (true){
            String s = scanner.nextLine();
            if ("exit".equals(s)){
                System.out.println("程序退出成功");
               break;
            }else {
                fos.write(s.getBytes(StandardCharsets.UTF_8));
            }
        }
        fos.close();

    }
}
